#include <stdio.h>
#include <string.h>
int main()
{
    FILE* fp = fopen("log.txt","w");
    if(fp == NULL)
    {
        perror("fail");
        return 1;
    }

    int cnt = 10;

    const char* msg = "Hello";
    while(cnt--)
    {
        char buffer[1024];
        snprintf(buffer,sizeof(buffer),"%s:%d\n",msg,cnt);        
        fwrite(buffer,strlen(buffer),1,fp);
    }




    fclose(fp);

    return 0;
}
